package com.huohuo.concurrent;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class ThreadPoolTest {
    public static void main(String[] args) {
        //1线程池中核心线程的大小，2线程池中线程的总大小，3 线程池中空闲线程存活的时间，4存活的时间单位，5工作队列，6线程池创建线程的工厂，7拒绝策略
        ThreadPoolExecutor executor = new ThreadPoolExecutor(2, 100, 200, TimeUnit.MILLISECONDS,
                new ArrayBlockingQueue<Runnable>(500));//, new ThreadPoolExecutor.DiscardOldestPolicy()

         executor.execute(new Runnable() {
             @Override
            public void run() {
                /* synchronized (Controller01.class) {
                     try {
                         HttpUtils.get("http://192.168.31.223:8085/test2.do");
                         System.out.println(System.currentTimeMillis());
                     } catch (Exception e) {
                         e.printStackTrace();
                     }
                 }*/
            }
        });
    }


}
